#ifndef _VL_RTSP_RUNNABLE_THREAD__H_
#define _VL_RTSP_RUNNABLE_THREAD__H_

#include "defs.h"
#include <thread>

namespace VLRTSP {

class RunnableThread {

public:
	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-12 09:11:10
	 * 
	 * 	线程执行函数回调
	 */
	using Runnable = std::function<void()>;

	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-12 09:13:57
	 * 
	 * 构造函数
	 * @param runnable 线程执行函数回调
	 */
	explicit RunnableThread(Runnable runnable);

	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-12 09:16:04
	 * 
	 * 析构函数
	 */
	~RunnableThread();

private:
	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-12 09:14:46
	 * 
	 * 线程回调函数
	 * @param runnable 线程执行函数回调
	 */
	void _threadRun(Runnable runnable);

	/**
	 * @Author: CimZzz
	 * @Date: 2022-01-12 09:13:10
	 * 
	 * 内部线程对象
	 */
	std::thread thread;
};

}

#endif //_VL_RTSP_RUNNABLE_THREAD__H_
